package com.wyb.controller;

import com.wyb.mapper.ArticleMapper;
import com.wyb.pojo.Article;
import com.wyb.constant.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedList;
import java.util.List;

@RestController
@RequestMapping("/createarticle")
public class AddArticle {
    @Autowired
    private ArticleMapper articleMapper;
    @PostMapping
    public Result addArticle(@RequestBody Article article){
        int insert = articleMapper.insert(article);
        List<String> list = new LinkedList();
        return insert!=0 ? new Result(200,"文章成功存入")
                         : new Result(201, "文章存入失败");
    }
}
